import matplotlib.pyplot as plt

# 设置 matplotlib 的字体以支持中文显示
plt.rcParams['font.sans-serif'] = ['SimHei']
# 解决负号显示问题
plt.rcParams['axes.unicode_minus'] = False

# 数据准备（按占比从大到小排序）
labels = ["阅读理解", "听说考试", "书面表达", "短文填空", "语法选择", "完型填空", "回答问题"]
sizes = [22.08, 20.55, 8.66, 6.40, 5.68, 5.72, 4.28]
colors = ["#FF6B6B", "#4ECDC4", "#45B7D1", "#96CEB4", "#FFEEAD", "#FF9999", "#D4A5A5"]

plt.figure(figsize=(10, 7))
plt.pie(sizes, labels=labels, colors=colors, autopct="%1.1f%%", startangle=90)
plt.axis("equal")  # 保持圆形
plt.title("考试部分分值占比分布图（总分73.95）")
plt.show()
